package conu.mapmaker.area;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JPanel;

/**
 * Sector holds a grid of boxes
 * 
 * @author FLiP
 * 
 */

public class Sector extends JPanel implements AreaInterface {

	Box[][] boxGrid = new Box[BOX_COUNT_X][BOX_COUNT_Y];
	public int x, y;
	boolean selected = false;
	double MPP;

	public Sector(int x, int y, double MPP) {
		this.x = x;
		this.y = y;
		this.MPP = MPP;
	}

	/**
	 * Method that makes Sector draw itself
	 * 
	 * @param g
	 *            Graphics variable that does all the drawing
	 */
	@Override
	public void paintComponent(Graphics g) {
		super.paintComponent(g);
		// LEL
		g.setColor(Color.green);
		// g.setColor(new Color((int) (Math.random() * 255), (int) (Math.random() * 255), (int) (Math.random() * 255)));

		if (selected) {
			g.fillRect(x, y, (int) (SECTOR_WIDTH_M / MPP), (int) (SECTOR_HEIGHT_M / MPP));
		} else {
			g.drawRect(x, y, (int) (SECTOR_WIDTH_M / MPP) - 1, (int) (SECTOR_HEIGHT_M / MPP) - 1);
		}

	}

	/**
	 * Boolean method determining select, duh.
	 * 
	 * @param select
	 *            Boolean determining whether or not the Sector is drawn filled
	 */
	public void setSelected(boolean select) {
		selected = select;
	}

}
